<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //函数默认的属性都是可以遍历的
        function user1(){
           this.say=function(){

           };
           

        }
        user1.prototype.show=function(){
            console.log("show...");
        };
        let u=new user1();
        //in 遍历本对象的属性，还有原型链上面的属性
        for (const key in u) {
              console.log(key);// say show
        }

        //但是class定义的，循环访问不到属性
        class user{

          show(){

          }
        }
        let u1=new user();
        for (const key in u1) {
            console.log(key);
        }
        //来看看class的属性定义
        // console.dir(user);
     console.log(JSON.stringify(Object.getOwnPropertyDescriptor(user.prototype,"show"),null,2));
//      {
//   "writable": true,
//   "enumerable": false,  //默认都是不可遍历的
//   "configurable": true
// }
    </script>
</body>
</html>